package cn.yuanqiao.activiti.listener;/**
 * @author 赵常飞
 * @date 2024/3/26 14:25
 */

import cn.yuanqiao.archive.danganzhengli.service.IOnlineReceptionService;
import cn.yuanqiao.common.exception.activiti.ArchiveProcessException;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 *@Author: 赵常飞
 *@Date: 2024/3/26 14:25
 *@Description:
 *@Note:
 */

@Component("ArchiveOnlineReceiveNotAgreeListener")
public class ArchiveOnlineReceiveNotAgreeListener implements ExecutionListener {
    @Autowired
    private IOnlineReceptionService onlineReceptionService;

    @Override
    public void notify(DelegateExecution delegateExecution) {
        Object onlinereceiveData = delegateExecution.getVariable("processVariables");

        if (onlinereceiveData == null){
            throw new ArchiveProcessException("接收单数据不能为空");
        }
        Map<String,Object> handOverData = (Map<String, Object>) onlinereceiveData;
        Integer id = onlineReceptionService.killOnlineReceive(Long.valueOf(handOverData.get("id").toString()));
        System.out.println("这里是在线接收不同意的节点");
    }
}
